<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<style>
			
		</style>
	</head>

	<body>
		<div id="progress">
			<div id="bar"></div>
		</div>
		<br />
		<button id="btn">点击</button>
		<script>
			var  btn=document.getElementById('bth');
			var bar=document.getElementById('bar')
			btn.onclick=function () {
				var time=setInterval(myfun,30)
				var width=1;
				function  myfun() {
					if (width>=100) {
						clearInterval(timer)
					} else{
						width+=3;
						bar.style.width=width+'%'
					}
				}
			}
		</script>
	</body>

</html>